var router = {
  ip:function (){
    return window.document.location.hostname;
  },
  /**
   * 获取当前网址 ulr
   * @returns {string}
   */
  urlPath:function () {
    return window.document.location.href;
  },
  /**
   * 获取主机地址之后的目录
   * @returns {string}
   */
  pathName:function () {
    return window.document.location.pathname;
  },
  /**
   * 获取项目url 端口
   * @returns {string}
   */
  portLocalhost:function(){
    return window.location.port;
  },
  /**
   * 获取主机端口号
   * @returns {*}
   */
  port:function () {
    return router.urlPath().indexOf(router.pathName());
  },
  /**
   * 获取主机地址
   * @returns {string | *}
   */
  localhostPaht:function () {
    return router.urlPath().substring(0, router.port());
  },
  /**
   * 获取项目包名称
   */
  projectName:function () {

    return router.pathName().substring(0, router.pathName().substr(1).indexOf('/') + 1);
  },
  ctx:function () {
      return router.localhostPaht();
  }
};
/**
 * 全局js
 * @type {{path: string}}
 */
var global = {
  //应用地址
  path: router.ctx() + "/",
};
global.router = router;